package com.skyline.jfs.storage.bean.impl;

import java.io.IOException;
import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.skyline.jfs.storage.bean.Loader;
import com.skyline.jfs.storage.bean.LoaderProxy;
import com.skyline.jfs.storage.service.Commander;

public class LoaderProxyImpl implements LoaderProxy {

	private static Map<String, Loader> loader = new HashMap<String, Loader>();

	private  Commander commander;
	
	private String ip;
	
	private String port;
	
	public LoaderProxyImpl(String ip,String port) throws MalformedURLException, RemoteException, NotBoundException{
		super();
		this.ip=ip;
		this.port=port;
		commander = (Commander) Naming.lookup("rmi://"+ip+":"+port+"/commander");
		System.out.println("======LoaderProxy has been created!======");
	}
	
	@Override
	public void load(String localFilePath, int duplic, String filePath) throws NotBoundException, IOException {
		// TODO Auto-generated method stub

	}

	@Override
	public List<String> getAbsoluteFilePath(String filePath) throws RemoteException {
		return commander.getAbsoluteFilePath(filePath);
	}

}
